package com.briup.day07;

/**
 * @author lining
 * @date 2024/1/16 17:02
 */
public class SuperClass {
    public int a = 2;
    private int id = 10;

    public int method(){
        System.out.println("父类的方法");
        return id;
    }

    public static void main(String[] args) {
        SubClass subClass = new SubClass();
        System.out.println(subClass.num);//1
        System.out.println(subClass.a);//2
        //子类对象可以调用父类中继承到的非私有的方法
        System.out.println(subClass.method());//id=10
    }
}
class SubClass extends SuperClass{
    public int num = 1;
}